home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / gymMat.lua < prev    next >
Text File  |  2004-01-29  |  1KB  |  41 lines

  1. -- camera state machine
  2.  
  3. beginStateMachine()
  4.  
  5.     onMsg("buildMenu", function(msg)
  6.     
  7.         if (repairMenu()) then return end
  8.     
  9.         -- build the pie menu
  10.         clearPieMenu();
  11.         local button;
  12.         button = addPieMenuButton("pm_makePushups", "makePushups");
  13.         button.addDescription(ACTIVITY, "makePushups");
  14.     end )
  15.  
  16.     -- 
  17.     onMsg("makePushups", function(msg)
  18.         -- get the game object server
  19.         local gameObjectServer = getGameObjectServer();
  20.         -- get character who initiated this action
  21.         local character = getStateObjectFromID(msg.sender);
  22.         -- walk to the closest action point
  23.         local actionPoint = character.getFreeActionPoint(this, "pushup");
  24.         if (actionPoint) then
  25.             -- get the walk state object
  26.             local wso = character.walkSO;
  27.             if (wso.walkToActionPoint(actionPoint)) then
  28.                 wso.queueStateMachine("gymMatChar.pushupStart", this);
  29.             else
  30.                 print("no path found");
  31.                 instantAbort(character, EMOTICON_NOPATH, "emoThink")
  32.             end
  33.         else
  34.             print("no action point found");
  35.             instantAbort(character, EMOTICON_CANNOT, "emoThink")
  36.         end
  37.     end )
  38.             
  39.             
  40. endStateMachine()
  41.